FROM ubuntu:20.04

ENV DEBIAN_FRONTEND noninteractive

ENV GOSU_VERSION 1.12

RUN apt-get update && apt-get install --yes apt-utils ca-certificates wget locales iputils-ping sudo gnupg2 curl htop vim mc \
  && `#----- Install the dependencies -----` \
  && apt-get install --yes fontconfig imagemagick \
  && `#----- Deal with ttf-mscorefonts-installer -----` \
  && apt-get install --yes xfonts-utils cabextract \
  && apt-get install --yes libgsf-1-114 ttf-mscorefonts-installer t1utils unixodbc \
  && wget --quiet --output-document /tmp/ttf-mscorefonts-installer_3.6_all.deb http://ftp.us.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb \
  && dpkg --install /tmp/ttf-mscorefonts-installer_3.6_all.deb 2> /dev/null \
  && rm /tmp/ttf-mscorefonts-installer_3.6_all.deb \
  && `#----- Install gosu -----` \
  && wget --quiet --output-document /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
  && chmod +x /usr/local/bin/gosu \
  && gosu nobody true 

RUN localedef --inputfile ru_RU --force --charmap UTF-8 --alias-file /usr/share/locale/locale.alias ru_RU.UTF-8
ENV LANG ru_RU.utf8

ADD *.deb /tmp/

ENV PLATFORM_VERSION 8.3.18.1208
ENV SERVER_VERSION 8.3.18-1208

RUN  dpkg --install /tmp/1c-enterprise-${PLATFORM_VERSION}-common_${SERVER_VERSION}_amd64.deb  \
  && dpkg --install /tmp/1c-enterprise-${PLATFORM_VERSION}-server_${SERVER_VERSION}_amd64.deb  \
  && rm /tmp/*.deb \
  && mkdir --parent /var/log/1C /home/usr1cv8/.1cv8/1C/1cv8/conf \
  && chown --recursive usr1cv8:grp1cv8 /var/log/1C /home/usr1cv8

COPY docker-entrypoint.sh /
COPY logcfg.xml /home/usr1cv8/.1cv8/1C/1cv8/conf

RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

VOLUME /home/usr1cv8
VOLUME /var/log/1C

EXPOSE 1540-1541 1560-1591
#CMD ["ragent"]
